import Love from "../love/love"
var love = new Love("main")
var ui = [
  { text: "快速游戏", tx: 150, ty: 300, w: 240, h: 100, onTouch: function () {love.switch("game")} }, //
  { text: "锦标赛", tx: 400, ty: 300, w: 240, h: 100, onTouch: function () { love.switch("game")}},
  { text: "车库", tx: 650, ty: 300, w: 240, h: 100 ,onTouch(){love.switch("garage")}},
  { text: "经销商", tx: 900, ty: 300, w: 240, h: 100 , onTouch: function(){love.switch("dealer")}},
  { text: "设置", tx: 1150, ty: 300, w: 240, h: 100 },
]

love.enter = function () {
  love.graphics.setDesignResolution(1600, 900)
  for (var i in ui) {
    let conf = ui[i]
    let rnd = Math.random()*2*3.14
    conf.x = 2000 * Math.sin(rnd)
    conf.y = 2000 * Math.cos(rnd)
    let btn = love.ui.newButton(conf)
    love.timer.newTween(1000, btn, { x: conf.tx, y: conf.ty }, "Quadratic.Out")
  }
  //love.touch.enableDebug(true)
}
love.update = function (dt) {
    love.particle.newParticle({
      x: [0, 1600],
      y: [0,900],
      life: 3000,
      dx: [-0.1,0.1],
      dy: [-0.1,0.1],
      type: "rect",
      size: [1,200],
      ds : [-1,0]
    },0.1)
}
love.draw = function () {
  
}
love.touch.onTouch = function (touch) {

}

export default love